# Maintainer: Mike Ruprecht <cmaiku@gmail.com>

_realname='gumbo-parser'
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.10.1
pkgrel=1
pkgdesc='HTML5 parsing library in pure C99 (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url='https://github.com/google/gumbo-parser'
license=(Apache)
checkdepends=(${MINGW_PACKAGE_PREFIX}-gtest)
options=(!libtool strip staticlibs)
source=("${_realname}-${pkgver}.tar.gz::https://github.com/google/gumbo-parser/archive/v${pkgver}.tar.gz")
sha256sums=('28463053d44a5dfbc4b77bcf49c8cee119338ffa636cc17fc3378421d714efad')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  ./autogen.sh
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"

  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}

  make
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make -k check
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make install DESTDIR="${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
